package guilddto

import (
	"github.com/gogf/gf/v2/frame/g"
	"xr-game-server/entity"
)

// 获取公会申请列表请求
type GuildApplicationsReq struct {
	g.Meta  `path:"/applications" method:"post" summary:"获取公会申请列表" tags:"公会"`
	GuildId uint64 `json:"guildId" v:"required" summary:"公会ID"`
}

// 公会申请信息
type GuildApplicationInfo struct {
	MemberRoleDto *MemberRoleDto `json:"roleInfo"`
	ApplyTime     string         `json:"applyTime" summary:"申请时间"`
}

// 获取公会申请列表响应
type GuildApplicationsRes struct {
	Applications []*GuildApplicationInfo `json:"applications" summary:"申请列表"`
}

// 将entity.GuildApplication转换为GuildApplicationInfo
func NewGuildApplicationsRes() *GuildApplicationsRes {
	ret := new(GuildApplicationsRes)
	ret.Applications = make([]*GuildApplicationInfo, 0)
	return ret
}

func NewGuildApplicationInfo(app *entity.GuildApplication, role *entity.PlayerRole) *GuildApplicationInfo {
	ret := new(GuildApplicationInfo)
	ret.MemberRoleDto = NewMemberRoleDto(role)
	ret.ApplyTime = app.CreatedAt.Format("2006-01-02 15:04:05")

	return ret
}

// 推送审批列表刷新
type PushApproveListRefreshReq struct {
	g.Meta `path:"/pushApproveListRefresh" method:"post" summary:"推送审批列表刷新" dc:"命令=21" tags:"公会"`
}
type PushApproveListRefreshRes struct {
	Cmd uint16 `json:"cmd" summary:"命令"`
}
